a11y: Proxy GtkWidget:accessible-role
authorEmmanuele Bassi <ebassi@gnome.org>
Tue, 10 Nov 2020 11:02:35 +0000 (11:02 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Tue, 10 Nov 2020 14:31:56 +0000 (14:31 +0000)
commit1bdc8b90618b059534d447912c09c11f6cf961ab
tree75710acfc4cd6b43f69d8ed4cb434e8c4d5a0724
parent2a3c3b4c6a697d6f902c3146eaa38b990e48f5f3
a11y: Proxy GtkWidget:accessible-role

The accessible-role property in GtkWidget has three possible targets:

 - the :accessible-role of a GtkATContext, if realized
 - the accessible_role field of GtkWidgetPrivate
 - the accessible_role field of GtkWidgetClassPrivate

When we set the accessible role of a widget using the GObject property
mechanism, we want to either set the GtkWidgetPrivate.accessible_role
field, if there's no ATContext *or* if the ATContext is not realized.
Conversely, when we get the accessible-role property we want to have a
series of fallbacks in place:

 - if GtkAccessible.get_at_context() returns an ATContext, and that
   ATContext is realized, return the :accessible-role of the context
 - if GtkWidgetPrivate.accessible_role is not WIDGET, return the
   stored accessible role
 - return GtkWidgetClassPrivate.accessible_role

This should help catch the case of getting the accessible role of
widgets that override GtkAccessible.get_at_context(), like
GtkModelButton.

See: #3342
gtk/gtkwidget.c